"use strict";(self.webpackChunkpromptmanager=self.webpackChunkpromptmanager||[]).push([[6348],{12705:function(e,t,n){n.d(t,{$5:function(){return _},C_:function(){return D},DK:function(){return N},Dg:function(){return L},Hn:function(){return Z},K4:function(){return w},MC:function(){return M},NM:function(){return C},TF:function(){return R},YL:function(){return g},c5:function(){return O},e7:function(){return H},eH:function(){return b},gZ:function(){return m},iB:function(){return y},jl:function(){return v},lo:function(){return F},nC:function(){return A},pQ:function(){return S},r1:function(){return h},rc:function(){return I},v:function(){return x},ye:function(){return T}});var r=n(4942),a=n(1413),i=n(74165),u=n(15861),o=n(56030),c=n(7077),s=(0,o.nZ)({key:"apiProvidersFetchSelector",get:function(){var e=(0,u.Z)((0,i.Z)().mark((function e(){var t;return(0,i.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,(0,c.o)().get("/api/apiproviders");case 3:return t=e.sent,e.abrupt("return",t.data);case 7:return e.prev=7,e.t0=e.catch(0),e.abrupt("return",[]);case 10:case"end":return e.stop()}}),e,null,[[0,7]])})));return function(){return e.apply(this,arguments)}}()}),l=(0,o.nZ)({key:"apiBackendsFetchSelector",get:function(){var e=(0,u.Z)((0,i.Z)().mark((function e(){var t;return(0,i.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,(0,c.o)().get("/api/apibackends");case 3:return t=e.sent,e.abrupt("return",t.data);case 7:return e.prev=7,e.t0=e.catch(0),e.abrupt("return",[]);case 10:case"end":return e.stop()}}),e,null,[[0,7]])})));return function(){return e.apply(this,arguments)}}()}),p=(0,o.nZ)({key:"endpointsFetchSelector",get:function(){var e=(0,u.Z)((0,i.Z)().mark((function e(){var t;return(0,i.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,(0,c.o)().get("/api/endpoints");case 3:return t=e.sent,e.abrupt("return",t.data);case 7:return e.prev=7,e.t0=e.catch(0),e.abrupt("return",[]);case 10:case"end":return e.stop()}}),e,null,[[0,7]])})));return function(){return e.apply(this,arguments)}}()}),d=(0,o.nZ)({key:"dataSourcesFetchSelector",get:function(){var e=(0,u.Z)((0,i.Z)().mark((function e(){var t;return(0,i.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,(0,c.o)().get("/api/datasources");case 3:return t=e.sent,e.abrupt("return",t.data);case 7:return e.prev=7,e.t0=e.catch(0),e.abrupt("return",[]);case 10:case"end":return e.stop()}}),e,null,[[0,7]])})));return function(){return e.apply(this,arguments)}}()}),f=(0,o.nZ)({key:"dataSourceTypesFetchSelector",get:function(){var e=(0,u.Z)((0,i.Z)().mark((function e(){var t;return(0,i.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,(0,c.o)().get("/api/datasource_types");case 3:return t=e.sent,e.abrupt("return",t.data);case 7:return e.prev=7,e.t0=e.catch(0),e.abrupt("return",[]);case 10:case"end":return e.stop()}}),e,null,[[0,7]])})));return function(){return e.apply(this,arguments)}}()}),h=(0,o.cn)({key:"apiProviders",default:s}),x=(0,o.nZ)({key:"apiProviderDropdownList",get:function(){var e=(0,u.Z)((0,i.Z)().mark((function e(t){var n,r;return(0,i.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.get,e.next=3,n(h);case 3:return r=e.sent,e.abrupt("return",r.map((function(e){return{label:e.name,value:e.name}})));case 5:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()}),v=(0,o.cn)({key:"apiProviderSelected",default:null}),g=(0,o.cn)({key:"apiBackends",default:l}),Z=(0,o.nZ)({key:"apiBackendDropdownList",get:function(e){var t=e.get,n=t(g),r=t(H);return n.filter((function(e){return-1===((null===r||void 0===r?void 0:r.disabled_api_backends)||[]).indexOf(e.id)})).map((function(e){return{label:e.name,value:e.id,provider:e.api_provider.name}}))}}),m=(0,o.cn)({key:"apiBackendSelected",default:null}),k=(0,o.cn)({key:"endpoints",default:p}),b=((0,o.nZ)({key:"endpointDropdownList",get:function(e){var t=(0,e.get)(k);return t.filter((function(e){return 0===e.version&&!e.draft})).sort((function(e,t){return e.created_on<t.created_on?1:-1})).map((function(e){return{label:"".concat(e.api_backend.api_provider.name," \xbb ").concat(e.api_backend.name," \xbb ").concat(e.name),uuid:e.uuid,options:t.filter((function(t){return t.parent_uuid===e.uuid})).map((function(t){return{label:"".concat(t.version,": ").concat(t.description),value:"".concat(t.parent_uuid,":").concat(t.version),version:t.version,backend:e.api_backend.name,provider:e.api_backend.api_provider.name,is_live:t.is_live,uuid:t.uuid}}))}}))}}),(0,o.cn)({key:"endpointSelected",default:null})),y=(0,o.nZ)({key:"endpointTableData",get:function(e){for(var t=(0,e.get)(k).filter((function(e){return!e.draft})).sort((function(e,t){return e.created_on<t.created_on?1:-1})),n=t.filter((function(e){return 0===e.version})).reduce((function(e,t){var n=(0,r.Z)({},t.uuid,(0,a.Z)((0,a.Z)({},t),{},{versions:[],key:t.uuid}));return(0,a.Z)((0,a.Z)({},e),n)}),{}),i=t.filter((function(e){return 0!==e.version})),u=0;u<i.length;u++)i[u].parent_uuid in n&&n[i[u].parent_uuid].versions.push((0,a.Z)((0,a.Z)({},i[u]),{},{key:i[u].uuid}));return Object.values(n)}}),w=((0,o.cn)({key:"endpointVersions",default:[]}),(0,o.cn)({key:"endpointConfigValue",default:{}})),S=(0,o.cn)({key:"promptValues",default:{}}),_=(0,o.cn)({key:"inputValue",default:{}}),j=((0,o.cn)({key:"saveEndpointModalVisible",default:!1}),(0,o.cn)({key:"saveEndpointVersionModalVisible",default:!1}),(0,o.cn)({key:"shareEndpointModalVisible",default:!1}),(0,o.cn)({key:"endpointShareCodeValue",default:null}),(0,o.nZ)({key:"profileFetchSelector",get:function(){var e=(0,u.Z)((0,i.Z)().mark((function e(){var t;return(0,i.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,(0,c.o)().get("/api/profiles/me");case 3:return t=e.sent,e.abrupt("return",t.data);case 7:return e.prev=7,e.t0=e.catch(0),e.abrupt("return",null);case 10:case"end":return e.stop()}}),e,null,[[0,7]])})));return function(){return e.apply(this,arguments)}}()})),I=(0,o.cn)({key:"profileValue",default:j}),A=(0,o.nZ)({key:"isLoggedIn",get:function(e){return null!==(0,e.get)(I)}}),E=(0,o.cn)({key:"promptHubState",default:[]}),C=((0,o.nZ)({key:"promptHubList",get:function(e){return(0,e.get)(E)}}),(0,o.cn)({key:"dataSourcesState",default:d})),O=(0,o.nZ)({key:"orgDataSourcesState",get:function(){var e=(0,u.Z)((0,i.Z)().mark((function e(t){var n,r;return(0,i.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=t.get,e.prev=1,n(L).IS_ORGANIZATION_MEMBER){e.next=5;break}return e.abrupt("return",[]);case 5:return e.next=7,(0,c.o)().get("/api/org/datasources");case 7:return r=e.sent,e.abrupt("return",r.data);case 11:return e.prev=11,e.t0=e.catch(1),e.abrupt("return",[]);case 14:case"end":return e.stop()}}),e,null,[[1,11]])})));return function(t){return e.apply(this,arguments)}}()}),R=(0,o.cn)({key:"dataSourceTypesState",default:f}),M=(0,o.cn)({key:"dataSourceEntriesState",default:[]}),N=(0,o.cn)({key:"orgDataSourceEntriesState",default:[]}),T=(0,o.nZ)({key:"dataSourceEntriesTableData",get:function(e){var t=e.get,n=t(M),r=t(L);n=n.map((function(e){return(0,a.Z)({isUserOwned:!0},e)}));var i=r.IS_ORGANIZATION_MEMBER?t(N):[];i=i.map((function(e){return(0,a.Z)({isUserOwned:!1},e)}));var u=t(C),o=(u=u.map((function(e){return(0,a.Z)({isUserOwned:!0},e)}))).map((function(e){return e.uuid})),c=r.IS_ORGANIZATION_MEMBER?t(O):[];c=(c=c.map((function(e){return(0,a.Z)({isUserOwned:!1},e)}))).filter((function(e){return!o.includes(e.uuid)}));for(var s=[],l={},p={},d=0;d<n.length;d++)n[d].datasource.uuid in l?l[n[d].datasource.uuid].push(n[d]):l[n[d].datasource.uuid]=[n[d]];for(var f=0;f<i.length;f++)i[f].datasource.uuid in p?p[i[f].datasource.uuid].push(i[f]):p[i[f].datasource.uuid]=[i[f]];for(var h=0;h<u.length;h++)s.push((0,a.Z)((0,a.Z)({},u[h]),{data_source_entries:l[u[h].uuid]||[]}));for(var x=0;x<c.length;x++)s.push((0,a.Z)((0,a.Z)({},c[x]),{data_source_entries:p[c[x].uuid]||[]}));return s}}),F=(0,o.cn)({key:"isMobileState",default:window.innerWidth<768}),B=((0,o.cn)({key:"appTemplateState",default:null}),(0,o.cn)({key:"appDebugState",default:{}}),(0,o.nZ)({key:"appsFetchSelector",get:function(){var e=(0,u.Z)((0,i.Z)().mark((function e(){var t;return(0,i.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,(0,c.o)().get("/api/apps");case 3:return t=e.sent,e.abrupt("return",t.data);case 7:return e.prev=7,e.t0=e.catch(0),e.abrupt("return",[]);case 10:case"end":return e.stop()}}),e,null,[[0,7]])})));return function(){return e.apply(this,arguments)}}()})),D=(0,o.cn)({key:"appsState",default:B}),W=(0,o.nZ)({key:"profileFlagsFetchSelector",get:function(){var e=(0,u.Z)((0,i.Z)().mark((function e(){var t;return(0,i.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,(0,c.o)().get("/api/profiles/me/flags");case 3:return t=e.sent,e.abrupt("return",t.data);case 7:return e.prev=7,e.t0=e.catch(0),e.abrupt("return",{});case 10:case"end":return e.stop()}}),e,null,[[0,7]])})));return function(){return e.apply(this,arguments)}}()}),L=(0,o.cn)({key:"profileFlagsState",default:W}),z=(0,o.nZ)({key:"organizationFetchSelector",get:function(){var e=(0,u.Z)((0,i.Z)().mark((function e(){var t;return(0,i.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,(0,c.o)().get("/api/org");case 3:return t=e.sent,e.abrupt("return",t.data);case 7:return e.prev=7,e.t0=e.catch(0),e.abrupt("return",null);case 10:case"end":return e.stop()}}),e,null,[[0,7]])})));return function(){return e.apply(this,arguments)}}()}),H=(0,o.cn)({key:"organizationState",default:z})},7077:function(e,t,n){n.d(t,{o:function(){return i}});var r=n(11912),a=n(58518),i=function(){var e=r.Z.create({xsrfCookieName:"csrftoken",xsrfHeaderName:"X-CSRFToken"});return e.interceptors.response.use((function(e){return e}),(function(e){return window.location.pathname.startsWith("/s/")||window.location.pathname.startsWith("/hub")||window.location.pathname.startsWith("/app/")||401!==e.response.status&&403!==e.response.status||(window.location.href="/login"),(0,a.yv)("Error Occurred",{variant:"error"}),Promise.reject(e)})),e}},86348:function(e,t,n){n.r(t),n.d(t,{default:function(){return I}});var r=n(93433),a=n(29439),i=n(43144),u=n(15671),o=n(7077),c=n(12705),s=n(72791),l=n(34663),p=n(64554),d=n(81918),f=n(48550),h=n(63466),x=n(20890),v=n(57621),g=n(72363),Z=n(9585),m=n(39504),k=n(11087),b=n(5403),y=n(34729),w=n(56030),S=n(80184),_=(0,i.Z)((function e(t,n,r,a,i){(0,u.Z)(this,e),this.type=t,this.title=n,this.description=r,this.tags=a,this.link=i}));function j(e){var t=e.filters,n=e.handleSearch,r=e.handleFilter,a=e.search,i=e.selectedFilter,u=void 0===i?"All":i;return(0,S.jsx)(l.Z,{sx:{position:"sticky",top:0,zIndex:1e3,margin:"5px",paddingTop:"2px",background:"white"},children:(0,S.jsxs)(y.Z,{container:!0,style:{alignItems:"center",width:"100%"},children:[(0,S.jsx)(y.Z,{item:!0,xs:12,md:8,children:(0,S.jsx)(p.Z,{sx:{textAlign:"left"},children:t.map((function(e){return(0,S.jsx)(d.Z,{sx:{margin:"5px",borderRadius:"10px"},label:e,onClick:function(){return r(e)},color:u===e?"primary":"default",background:"white"},e)}))})}),(0,S.jsx)(y.Z,{item:!0,xs:12,md:4,children:(0,S.jsx)(p.Z,{sx:{textAlign:"end"},children:(0,S.jsx)(f.Z,{placeholder:"Search",value:a,onChange:n,size:"small",InputProps:{sx:{borderRadius:"10px"},startAdornment:(0,S.jsx)(h.Z,{position:"start",children:(0,S.jsx)(b.Z,{fontSize:"small"})})}})})})]})})}function I(){var e=(0,k.lr)(),t=(0,a.Z)(e,1)[0],n=(0,s.useState)([]),i=(0,a.Z)(n,2),u=i[0],l=i[1],f=(0,s.useState)([]),h=(0,a.Z)(f,2),b=h[0],I=h[1],A=(0,s.useState)(["All"]),E=(0,a.Z)(A,2),C=E[0],O=E[1],R=(0,s.useState)("All"),M=(0,a.Z)(R,2),N=M[0],T=M[1],F=(0,s.useState)(""),B=(0,a.Z)(F,2),D=B[0],W=B[1],L=(0,s.useState)([]),z=(0,a.Z)(L,2),H=z[0],V=z[1],G=(0,w.sJ)(c.Dg),P=(0,w.sJ)(c.e7),U={textAlign:"left",width:"100%",fontFamily:"Lato, sans-serif",marginBottom:"10px",padding:"5px 10px",fontWeight:600,borderRadius:"5px",color:"#1c3c5a",fontSize:"18px",borderBottom:"solid 3px #1c3c5a",borderLeft:"solid 1px #ccc",borderRight:"solid 1px #ccc",display:G.IS_ORGANIZATION_MEMBER?"block":"none"};return(0,s.useEffect)((function(){(0,o.o)().get("/api/appHub").then((function(e){var t=e.data.map((function(e){var t="/app/".concat(e.published_uuid),n=((null===e||void 0===e?void 0:e.categories)||[]).map((function(e){return e.name}));return 0===n.length&&n.push("Productivity"),new _("app",e.name,e.description,n,t)}));l(t)})).catch((function(e){})).then({})}),[l]),(0,s.useEffect)((function(){G.IS_ORGANIZATION_MEMBER&&(0,o.o)().get("/api/org/apps").then((function(e){V(e.data)}))}),[G.IS_ORGANIZATION_MEMBER,V]),(0,s.useEffect)((function(){I((0,r.Z)(u));var e=(0,r.Z)((0,r.Z)(u).map((function(e){return e.tags})));O(["All"].concat((0,r.Z)(new Set(e.flat())))),t.get("filter")&&T(t.get("filter")),t.get("search")&&W(t.get("search"))}),[u,t]),(0,s.useEffect)((function(){var e=(0,r.Z)(u);N&&"All"!==N&&(e=e.filter((function(e){return e.tags.includes(N)}))),""!==D&&(e=e.filter((function(e){return e.title.toLowerCase().includes(D.toLowerCase())}))),I(e)}),[N,D,u]),(0,S.jsx)("div",{children:(0,S.jsxs)(p.Z,{children:[(0,S.jsx)(j,{filters:C,selectedFilter:N,handleFilter:function(e){return T(e)},handleSearch:function(e){return W(e.target.value)},search:D}),(0,S.jsxs)(x.Z,{style:U,variant:"h5",children:["Apps from ",null===P||void 0===P?void 0:P.name]}),(0,S.jsx)(y.Z,{container:!0,sx:{marginTop:"10px",display:G.IS_ORGANIZATION_MEMBER?"flex":"none"},spacing:{xs:1,md:1},columns:{xs:1,sm:8,md:12},children:H.map((function(e,t){return(0,S.jsx)(y.Z,{item:!0,sx:{display:"flex",justifyContent:"center",flexDirection:"row",marginBottom:"20px"},md:{flexDirection:"column"},children:(0,S.jsx)("a",{href:"/app/".concat(e.published_uuid),children:(0,S.jsxs)(v.Z,{sx:{width:{xs:"100%",md:200},height:120,maxHeight:150,borderRadius:{xs:"3px",md:"10px"},position:"relative",cursor:"pointer",margin:"6px",background:"white",zIndex:2,display:"flex",alignItems:"center",justifyContent:"center",flexDirection:"column"},className:"discover-card",elevation:5,children:[(0,S.jsx)(x.Z,{fontSize:18,fontWeight:700,color:"#183A58",sx:{display:"-webkit-box",WebkitBoxOrient:"vertical",WebkitLineClamp:2,overflow:"hidden",marginTop:"10px"},children:null===e||void 0===e?void 0:e.name}),(0,S.jsx)(g.Z,{sx:{marginTop:"10px"},children:(0,S.jsx)(d.Z,{label:e.owner_email.split("@")[0],sx:{height:"22px",backgroundColor:"#CCC",color:"black",borderRadius:"10px"}})})]})})},t)}))}),(0,S.jsx)(x.Z,{style:U,variant:"h5",children:"Featured Apps"}),(0,S.jsx)(y.Z,{container:!0,sx:{marginTop:"10px"},spacing:{xs:1,md:1},columns:{xs:1,sm:8,md:12},children:b.map((function(e,t){return(0,S.jsx)(y.Z,{item:!0,sx:{position:"relative",display:"flex",justifyContent:"center"},children:(0,S.jsx)("a",{href:"".concat(window.location.protocol,"//").concat(window.location.host).concat(e.link),children:(0,S.jsxs)(v.Z,{sx:{width:{xs:"100%",md:228},minWidth:{md:228},height:250,maxHeight:310,borderRadius:{xs:"3px",md:"10px"},cursor:"pointer",margin:"6px",background:"white",zIndex:2},className:"discover-card",elevation:5,onClick:function(){return window.location.href=e.link},children:[(0,S.jsx)(Z.Z,{title:(0,S.jsx)(x.Z,{fontSize:20,fontWeight:700,color:"#183A58",sx:{display:"-webkit-box",WebkitBoxOrient:"vertical",WebkitLineClamp:2,overflow:"hidden",marginTop:"10px"},children:null===e||void 0===e?void 0:e.title}),sx:{paddingBottom:0}}),(0,S.jsx)(m.Z,{className:"discover-card-content",sx:{padding:1,maxHeight:"60%",maxWidth:"100%",overflow:"scroll",color:"#555",fontSize:"16px",lineHeight:"1.3em"},children:null===e||void 0===e?void 0:e.description}),(0,S.jsx)(g.Z,{sx:{position:"absolute",background:"#fff",bottom:15,width:"90%"},children:(0,S.jsx)(p.Z,{sx:{width:"100%"},children:e.tags.slice(0,5).map((function(e,t){return(0,S.jsx)(d.Z,{label:e.length>10?e.substr(0,5)+"...":e,sx:{height:"24px",margin:"2px",borderRadius:"10px"}},t)}))})})]})})},t)}))})]})})}}}]);
//# sourceMappingURL=6348.835380fe.chunk.js.map